package net.zjitc.atest.controller;



import net.zjitc.atest.pojo.Category;
import net.zjitc.atest.service.CategoryService;
import net.zjitc.atest.util.APIResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @RequestMapping("/findAll")
    @ResponseBody
    public APIResponse<List<Category>> category(){
        List<Category> list = categoryService.findAll();
        return new APIResponse<List<Category>>(0,"请求成功",list);
    }
}
